package com.wwy.arithmetic.suanfa;




public class BuChongFuZiFu {

    public static void main(String[] args) {

        int abcsdwssaaa = judge("abcsdwssaaa");
        System.out.println("abcsdwssaaa = " + abcsdwssaaa);
    }

    static int judge(String s) {
        char[] arr = s.toCharArray();
        int max = 0;
        int left = 0;
        int length = 0;
        for(int right = 0; right < arr.length; right++) {
            for(int k = left; k < right; k++) {
                if(arr[right] == arr[k]) {
                    left = k + 1;
                    length = right - left;
                    break;
                }
            }
            length++;
            max = Math.max(max, length);
        }

        return max;
    }


}
